#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(b > d)
    {
        c--;
        d = d + 60;
    }
    printf("%d %d",c-a,d-b);
}